var express = require('express');
var router = express.Router();

//获取管理员列表数据
const { getAdmins, delAdmins,changeState, addAdmins, modifyAdmins } = require('../service/adminsService')
router.get('/getAdmins', async function (req, res, next) {
  res.send(await getAdmins(req.query));
})


// 修改管理员
router.post('/changeAdmins', async (req, res, next) => {
  res.send(await modifyAdmins(req.body))
})

//删除管理数据byId
router.post('/delAdmins', async function (req, res, next) {
  console.log(req.body, 333);
  res.send(await delAdmins(req.body))
})

//修改管理状态byId
router.post('/changeState', async function (req, res, next) {
  console.log(req.body, 333);
  res.send(await changeState(req.body))
})
//新增
router.post('/addAdmins', async function (req, res, next) {
  // console.log(req.body,9999);
  res.send(await addAdmins(req.body))
})

module.exports = router;